﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using CBRSystem.Entities;
using CBRSystem.Data;

#endregion

namespace CBRSystem.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="StudentProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class StudentProviderBaseCore : EntityProviderBase<CBRSystem.Entities.Student, CBRSystem.Entities.StudentKey>
	{		
		#region Get from Many To Many Relationship Functions
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, CBRSystem.Entities.StudentKey key)
		{
			return Delete(transactionManager, key.StudentId);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="_studentId">The primary key.. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Int32 _studentId)
		{
			return Delete(null, _studentId);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_studentId">The primary key.. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Int32 _studentId);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override CBRSystem.Entities.Student Get(TransactionManager transactionManager, CBRSystem.Entities.StudentKey key, int start, int pageLength)
		{
			return GetByStudentId(transactionManager, key.StudentId, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_Student index.
		/// </summary>
		/// <param name="_studentId">The primary key.</param>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Student"/> class.</returns>
		public CBRSystem.Entities.Student GetByStudentId(System.Int32 _studentId)
		{
			int count = -1;
			return GetByStudentId(null,_studentId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Student index.
		/// </summary>
		/// <param name="_studentId">The primary key.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Student"/> class.</returns>
		public CBRSystem.Entities.Student GetByStudentId(System.Int32 _studentId, int start, int pageLength)
		{
			int count = -1;
			return GetByStudentId(null, _studentId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Student index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_studentId">The primary key.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Student"/> class.</returns>
		public CBRSystem.Entities.Student GetByStudentId(TransactionManager transactionManager, System.Int32 _studentId)
		{
			int count = -1;
			return GetByStudentId(transactionManager, _studentId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Student index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_studentId">The primary key.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Student"/> class.</returns>
		public CBRSystem.Entities.Student GetByStudentId(TransactionManager transactionManager, System.Int32 _studentId, int start, int pageLength)
		{
			int count = -1;
			return GetByStudentId(transactionManager, _studentId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Student index.
		/// </summary>
		/// <param name="_studentId">The primary key.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Student"/> class.</returns>
		public CBRSystem.Entities.Student GetByStudentId(System.Int32 _studentId, int start, int pageLength, out int count)
		{
			return GetByStudentId(null, _studentId, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Student index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_studentId">The primary key.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Student"/> class.</returns>
		public abstract CBRSystem.Entities.Student GetByStudentId(TransactionManager transactionManager, System.Int32 _studentId, int start, int pageLength, out int count);
						
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key IX_Student_GivenSchoolID index.
		/// </summary>
		/// <param name="_givenSchoolId">The unique ID generated for the student by the school.</param>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Student"/> class.</returns>
		public CBRSystem.Entities.Student GetByGivenSchoolId(System.String _givenSchoolId)
		{
			int count = -1;
			return GetByGivenSchoolId(null,_givenSchoolId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_GivenSchoolID index.
		/// </summary>
		/// <param name="_givenSchoolId">The unique ID generated for the student by the school.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Student"/> class.</returns>
		public CBRSystem.Entities.Student GetByGivenSchoolId(System.String _givenSchoolId, int start, int pageLength)
		{
			int count = -1;
			return GetByGivenSchoolId(null, _givenSchoolId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_GivenSchoolID index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_givenSchoolId">The unique ID generated for the student by the school.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Student"/> class.</returns>
		public CBRSystem.Entities.Student GetByGivenSchoolId(TransactionManager transactionManager, System.String _givenSchoolId)
		{
			int count = -1;
			return GetByGivenSchoolId(transactionManager, _givenSchoolId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_GivenSchoolID index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_givenSchoolId">The unique ID generated for the student by the school.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Student"/> class.</returns>
		public CBRSystem.Entities.Student GetByGivenSchoolId(TransactionManager transactionManager, System.String _givenSchoolId, int start, int pageLength)
		{
			int count = -1;
			return GetByGivenSchoolId(transactionManager, _givenSchoolId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_GivenSchoolID index.
		/// </summary>
		/// <param name="_givenSchoolId">The unique ID generated for the student by the school.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Student"/> class.</returns>
		public CBRSystem.Entities.Student GetByGivenSchoolId(System.String _givenSchoolId, int start, int pageLength, out int count)
		{
			return GetByGivenSchoolId(null, _givenSchoolId, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_GivenSchoolID index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_givenSchoolId">The unique ID generated for the student by the school.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Student"/> class.</returns>
		public abstract CBRSystem.Entities.Student GetByGivenSchoolId(TransactionManager transactionManager, System.String _givenSchoolId, int start, int pageLength, out int count);
						
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key IX_Student_LastName index.
		/// </summary>
		/// <param name="_lastName">The student’s last name (surname).</param>
		/// <returns>Returns an instance of the <see cref="TList&lt;Student&gt;"/> class.</returns>
		public TList<Student> GetByLastName(System.String _lastName)
		{
			int count = -1;
			return GetByLastName(null,_lastName, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_LastName index.
		/// </summary>
		/// <param name="_lastName">The student’s last name (surname).</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Student&gt;"/> class.</returns>
		public TList<Student> GetByLastName(System.String _lastName, int start, int pageLength)
		{
			int count = -1;
			return GetByLastName(null, _lastName, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_LastName index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_lastName">The student’s last name (surname).</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Student&gt;"/> class.</returns>
		public TList<Student> GetByLastName(TransactionManager transactionManager, System.String _lastName)
		{
			int count = -1;
			return GetByLastName(transactionManager, _lastName, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_LastName index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_lastName">The student’s last name (surname).</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Student&gt;"/> class.</returns>
		public TList<Student> GetByLastName(TransactionManager transactionManager, System.String _lastName, int start, int pageLength)
		{
			int count = -1;
			return GetByLastName(transactionManager, _lastName, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_LastName index.
		/// </summary>
		/// <param name="_lastName">The student’s last name (surname).</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Student&gt;"/> class.</returns>
		public TList<Student> GetByLastName(System.String _lastName, int start, int pageLength, out int count)
		{
			return GetByLastName(null, _lastName, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_LastName index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_lastName">The student’s last name (surname).</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="TList&lt;Student&gt;"/> class.</returns>
		public abstract TList<Student> GetByLastName(TransactionManager transactionManager, System.String _lastName, int start, int pageLength, out int count);
						
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key IX_Student_FirstName index.
		/// </summary>
		/// <param name="_firstName">The student’s first name (proper name).</param>
		/// <returns>Returns an instance of the <see cref="TList&lt;Student&gt;"/> class.</returns>
		public TList<Student> GetByFirstName(System.String _firstName)
		{
			int count = -1;
			return GetByFirstName(null,_firstName, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_FirstName index.
		/// </summary>
		/// <param name="_firstName">The student’s first name (proper name).</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Student&gt;"/> class.</returns>
		public TList<Student> GetByFirstName(System.String _firstName, int start, int pageLength)
		{
			int count = -1;
			return GetByFirstName(null, _firstName, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_FirstName index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_firstName">The student’s first name (proper name).</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Student&gt;"/> class.</returns>
		public TList<Student> GetByFirstName(TransactionManager transactionManager, System.String _firstName)
		{
			int count = -1;
			return GetByFirstName(transactionManager, _firstName, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_FirstName index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_firstName">The student’s first name (proper name).</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Student&gt;"/> class.</returns>
		public TList<Student> GetByFirstName(TransactionManager transactionManager, System.String _firstName, int start, int pageLength)
		{
			int count = -1;
			return GetByFirstName(transactionManager, _firstName, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_FirstName index.
		/// </summary>
		/// <param name="_firstName">The student’s first name (proper name).</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Student&gt;"/> class.</returns>
		public TList<Student> GetByFirstName(System.String _firstName, int start, int pageLength, out int count)
		{
			return GetByFirstName(null, _firstName, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Student_FirstName index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_firstName">The student’s first name (proper name).</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="TList&lt;Student&gt;"/> class.</returns>
		public abstract TList<Student> GetByFirstName(TransactionManager transactionManager, System.String _firstName, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#region Student_LookupFinalCourseMark 
		
		/// <summary>
		///	This method wrap the 'Student_LookupFinalCourseMark' stored procedure. 
		/// </summary>
		/// <param name="studentId"> A <c>System.Int64?</c> instance.</param>
		/// <param name="courseNumber"> A <c>System.String</c> instance.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void LookupFinalCourseMark(System.Int64? studentId, System.String courseNumber)
		{
			 LookupFinalCourseMark(null, 0, int.MaxValue , studentId, courseNumber);
		}
		
		/// <summary>
		///	This method wrap the 'Student_LookupFinalCourseMark' stored procedure. 
		/// </summary>
		/// <param name="studentId"> A <c>System.Int64?</c> instance.</param>
		/// <param name="courseNumber"> A <c>System.String</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void LookupFinalCourseMark(int start, int pageLength, System.Int64? studentId, System.String courseNumber)
		{
			 LookupFinalCourseMark(null, start, pageLength , studentId, courseNumber);
		}
				
		/// <summary>
		///	This method wrap the 'Student_LookupFinalCourseMark' stored procedure. 
		/// </summary>
		/// <param name="studentId"> A <c>System.Int64?</c> instance.</param>
		/// <param name="courseNumber"> A <c>System.String</c> instance.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void LookupFinalCourseMark(TransactionManager transactionManager, System.Int64? studentId, System.String courseNumber)
		{
			 LookupFinalCourseMark(transactionManager, 0, int.MaxValue , studentId, courseNumber);
		}
		
		/// <summary>
		///	This method wrap the 'Student_LookupFinalCourseMark' stored procedure. 
		/// </summary>
		/// <param name="studentId"> A <c>System.Int64?</c> instance.</param>
		/// <param name="courseNumber"> A <c>System.String</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public abstract void LookupFinalCourseMark(TransactionManager transactionManager, int start, int pageLength , System.Int64? studentId, System.String courseNumber);
		
		#endregion
		
		#region Student_LookupByCourseEligibility 
		
		/// <summary>
		///	This method wrap the 'Student_LookupByCourseEligibility' stored procedure. 
		/// </summary>
		/// <param name="courseId"> A <c>System.Int32?</c> instance.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void LookupByCourseEligibility(System.Int32? courseId)
		{
			 LookupByCourseEligibility(null, 0, int.MaxValue , courseId);
		}
		
		/// <summary>
		///	This method wrap the 'Student_LookupByCourseEligibility' stored procedure. 
		/// </summary>
		/// <param name="courseId"> A <c>System.Int32?</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void LookupByCourseEligibility(int start, int pageLength, System.Int32? courseId)
		{
			 LookupByCourseEligibility(null, start, pageLength , courseId);
		}
				
		/// <summary>
		///	This method wrap the 'Student_LookupByCourseEligibility' stored procedure. 
		/// </summary>
		/// <param name="courseId"> A <c>System.Int32?</c> instance.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void LookupByCourseEligibility(TransactionManager transactionManager, System.Int32? courseId)
		{
			 LookupByCourseEligibility(transactionManager, 0, int.MaxValue , courseId);
		}
		
		/// <summary>
		///	This method wrap the 'Student_LookupByCourseEligibility' stored procedure. 
		/// </summary>
		/// <param name="courseId"> A <c>System.Int32?</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public abstract void LookupByCourseEligibility(TransactionManager transactionManager, int start, int pageLength , System.Int32? courseId);
		
		#endregion
		
		#region Student_LookupTranscript 
		
		/// <summary>
		///	This method wrap the 'Student_LookupTranscript' stored procedure. 
		/// </summary>
		/// <param name="studentId"> A <c>System.Int64?</c> instance.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void LookupTranscript(System.Int64? studentId)
		{
			 LookupTranscript(null, 0, int.MaxValue , studentId);
		}
		
		/// <summary>
		///	This method wrap the 'Student_LookupTranscript' stored procedure. 
		/// </summary>
		/// <param name="studentId"> A <c>System.Int64?</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void LookupTranscript(int start, int pageLength, System.Int64? studentId)
		{
			 LookupTranscript(null, start, pageLength , studentId);
		}
				
		/// <summary>
		///	This method wrap the 'Student_LookupTranscript' stored procedure. 
		/// </summary>
		/// <param name="studentId"> A <c>System.Int64?</c> instance.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void LookupTranscript(TransactionManager transactionManager, System.Int64? studentId)
		{
			 LookupTranscript(transactionManager, 0, int.MaxValue , studentId);
		}
		
		/// <summary>
		///	This method wrap the 'Student_LookupTranscript' stored procedure. 
		/// </summary>
		/// <param name="studentId"> A <c>System.Int64?</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public abstract void LookupTranscript(TransactionManager transactionManager, int start, int pageLength , System.Int64? studentId);
		
		#endregion
		
		#region Student_LookupByActiveTerm 
		
		/// <summary>
		///	This method wrap the 'Student_LookupByActiveTerm' stored procedure. 
		/// </summary>
		/// <param name="term"> A <c>System.Int16?</c> instance.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void LookupByActiveTerm(System.Int16? term)
		{
			 LookupByActiveTerm(null, 0, int.MaxValue , term);
		}
		
		/// <summary>
		///	This method wrap the 'Student_LookupByActiveTerm' stored procedure. 
		/// </summary>
		/// <param name="term"> A <c>System.Int16?</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void LookupByActiveTerm(int start, int pageLength, System.Int16? term)
		{
			 LookupByActiveTerm(null, start, pageLength , term);
		}
				
		/// <summary>
		///	This method wrap the 'Student_LookupByActiveTerm' stored procedure. 
		/// </summary>
		/// <param name="term"> A <c>System.Int16?</c> instance.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void LookupByActiveTerm(TransactionManager transactionManager, System.Int16? term)
		{
			 LookupByActiveTerm(transactionManager, 0, int.MaxValue , term);
		}
		
		/// <summary>
		///	This method wrap the 'Student_LookupByActiveTerm' stored procedure. 
		/// </summary>
		/// <param name="term"> A <c>System.Int16?</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public abstract void LookupByActiveTerm(TransactionManager transactionManager, int start, int pageLength , System.Int16? term);
		
		#endregion
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a TList&lt;Student&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="TList&lt;Student&gt;"/></returns>
		public static TList<Student> Fill(IDataReader reader, TList<Student> rows, int start, int pageLength)
		{
			NetTiersProvider currentProvider = DataRepository.Provider;
            bool useEntityFactory = currentProvider.UseEntityFactory;
            bool enableEntityTracking = currentProvider.EnableEntityTracking;
            LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy;
			Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType;
			
			// advance to the starting row
			for (int i = 0; i < start; i++)
			{
				if (!reader.Read())
				return rows; // not enough rows, just return
			}
			for (int i = 0; i < pageLength; i++)
			{
				if (!reader.Read())
					break; // we are done
					
				string key = null;
				
				CBRSystem.Entities.Student c = null;
				if (useEntityFactory)
				{
					key = new System.Text.StringBuilder("Student")
					.Append("|").Append((System.Int32)reader[((int)StudentColumn.StudentId - 1)]).ToString();
					c = EntityManager.LocateOrCreate<Student>(
					key.ToString(), // EntityTrackingKey
					"Student",  //Creational Type
					entityCreationFactoryType,  //Factory used to create entity
					enableEntityTracking); // Track this entity?
				}
				else
				{
					c = new CBRSystem.Entities.Student();
				}
				
				if (!enableEntityTracking ||
					c.EntityState == EntityState.Added ||
					(enableEntityTracking &&
					
						(
							(currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
							(currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged)
						)
					))
				{
					c.SuppressEntityEvents = true;
					c.StudentId = (System.Int32)reader[((int)StudentColumn.StudentId - 1)];
					c.GivenSchoolId = (System.String)reader[((int)StudentColumn.GivenSchoolId - 1)];
					c.FirstName = (System.String)reader[((int)StudentColumn.FirstName - 1)];
					c.LastName = (System.String)reader[((int)StudentColumn.LastName - 1)];
					c.Gender = (System.String)reader[((int)StudentColumn.Gender - 1)];
					c.EntityTrackingKey = key;
					c.AcceptChanges();
					c.SuppressEntityEvents = false;
				}
				rows.Add(c);
			}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="CBRSystem.Entities.Student"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="CBRSystem.Entities.Student"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, CBRSystem.Entities.Student entity)
		{
			if (!reader.Read()) return;
			
			entity.StudentId = (System.Int32)reader[((int)StudentColumn.StudentId - 1)];
			entity.GivenSchoolId = (System.String)reader[((int)StudentColumn.GivenSchoolId - 1)];
			entity.FirstName = (System.String)reader[((int)StudentColumn.FirstName - 1)];
			entity.LastName = (System.String)reader[((int)StudentColumn.LastName - 1)];
			entity.Gender = (System.String)reader[((int)StudentColumn.Gender - 1)];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="CBRSystem.Entities.Student"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="CBRSystem.Entities.Student"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, CBRSystem.Entities.Student entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.StudentId = (System.Int32)dataRow["StudentID"];
			entity.GivenSchoolId = (System.String)dataRow["GivenSchoolID"];
			entity.FirstName = (System.String)dataRow["FirstName"];
			entity.LastName = (System.String)dataRow["LastName"];
			entity.Gender = (System.String)dataRow["Gender"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="CBRSystem.Entities.Student"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">CBRSystem.Entities.Student Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		public override void DeepLoad(TransactionManager transactionManager, CBRSystem.Entities.Student entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			// Deep load child collections  - Call GetByStudentId methods when available
			
			#region StudentMarkCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<StudentMark>|StudentMarkCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'StudentMarkCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.StudentMarkCollection = DataRepository.StudentMarkProvider.GetByStudentId(transactionManager, entity.StudentId);

				if (deep && entity.StudentMarkCollection.Count > 0)
				{
					deepHandles.Add("StudentMarkCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<StudentMark>) DataRepository.StudentMarkProvider.DeepLoad,
						new object[] { transactionManager, entity.StudentMarkCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region EnrolledStudentCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<EnrolledStudent>|EnrolledStudentCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'EnrolledStudentCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.EnrolledStudentCollection = DataRepository.EnrolledStudentProvider.GetByStudentId(transactionManager, entity.StudentId);

				if (deep && entity.EnrolledStudentCollection.Count > 0)
				{
					deepHandles.Add("EnrolledStudentCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<EnrolledStudent>) DataRepository.EnrolledStudentProvider.DeepLoad,
						new object[] { transactionManager, entity.EnrolledStudentCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the CBRSystem.Entities.Student object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">CBRSystem.Entities.Student instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">CBRSystem.Entities.Student Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		public override bool DeepSave(TransactionManager transactionManager, CBRSystem.Entities.Student entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
	
			#region List<StudentMark>
				if (CanDeepSave(entity.StudentMarkCollection, "List<StudentMark>|StudentMarkCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(StudentMark child in entity.StudentMarkCollection)
					{
						if(child.StudentIdSource != null)
						{
							child.StudentId = child.StudentIdSource.StudentId;
						}
						else
						{
							child.StudentId = entity.StudentId;
						}

					}

					if (entity.StudentMarkCollection.Count > 0 || entity.StudentMarkCollection.DeletedItems.Count > 0)
					{
						//DataRepository.StudentMarkProvider.Save(transactionManager, entity.StudentMarkCollection);
						
						deepHandles.Add("StudentMarkCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< StudentMark >) DataRepository.StudentMarkProvider.DeepSave,
							new object[] { transactionManager, entity.StudentMarkCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<EnrolledStudent>
				if (CanDeepSave(entity.EnrolledStudentCollection, "List<EnrolledStudent>|EnrolledStudentCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(EnrolledStudent child in entity.EnrolledStudentCollection)
					{
						if(child.StudentIdSource != null)
						{
							child.StudentId = child.StudentIdSource.StudentId;
						}
						else
						{
							child.StudentId = entity.StudentId;
						}

					}

					if (entity.EnrolledStudentCollection.Count > 0 || entity.EnrolledStudentCollection.DeletedItems.Count > 0)
					{
						//DataRepository.EnrolledStudentProvider.Save(transactionManager, entity.EnrolledStudentCollection);
						
						deepHandles.Add("EnrolledStudentCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< EnrolledStudent >) DataRepository.EnrolledStudentProvider.DeepSave,
							new object[] { transactionManager, entity.EnrolledStudentCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region StudentChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>CBRSystem.Entities.Student</c>
	///</summary>
	public enum StudentChildEntityTypes
	{

		///<summary>
		/// Collection of <c>Student</c> as OneToMany for StudentMarkCollection
		///</summary>
		[ChildEntityType(typeof(TList<StudentMark>))]
		StudentMarkCollection,

		///<summary>
		/// Collection of <c>Student</c> as OneToMany for EnrolledStudentCollection
		///</summary>
		[ChildEntityType(typeof(TList<EnrolledStudent>))]
		EnrolledStudentCollection,
	}
	
	#endregion StudentChildEntityTypes
	
	#region StudentFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;StudentColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Student"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class StudentFilterBuilder : SqlFilterBuilder<StudentColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the StudentFilterBuilder class.
		/// </summary>
		public StudentFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the StudentFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public StudentFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the StudentFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public StudentFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion StudentFilterBuilder
	
	#region StudentParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;StudentColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Student"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class StudentParameterBuilder : ParameterizedSqlFilterBuilder<StudentColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the StudentParameterBuilder class.
		/// </summary>
		public StudentParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the StudentParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public StudentParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the StudentParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public StudentParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion StudentParameterBuilder
	
	#region StudentSortBuilder
    
    /// <summary>
    /// A strongly-typed instance of the <see cref="SqlSortBuilder&lt;StudentColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Student"/> object.
    /// </summary>
    [CLSCompliant(true)]
    public class StudentSortBuilder : SqlSortBuilder<StudentColumn>
    {
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the StudentSqlSortBuilder class.
		/// </summary>
		public StudentSortBuilder() : base() { }

		#endregion Constructors

    }    
    #endregion StudentSortBuilder
	
} // end namespace
